%% Calculate subdivision points of curve
n = size(P,1); % number of sites
 
[A1 A2 B11 B12 B21 B22 m] = loadMatrix(n,N);

%% Toeplitz matrix for C1=C2=...=CN
top = toeplitz([1; zeros(N-2,1); -1], [1 -1 zeros(1,N-2)]);
T = zeros(m,m);
for i=1:(m/N)
   T((i-1)*N+1:i*N,(i-1)*N+1:i*N) = top; 
end
T2 = toeplitz([1;zeros(2*n-3,1); -1],[1 -1 zeros(1,2*n-3)]);
T2 = T2(1:length(T2)-1,:);